COMPONENT=src/SensoBygAppC
CFLAGS += -Isrc
CFLAGS += -I$(TOSDIR)/lib/net \
          -I$(TOSDIR)/lib/net/le \
          -I$(TOSDIR)/lib/net/ctp
CFLAGS += -I$(TOSDIR)/lib/net/drip
CFLAGS += -I$(TOSDIR)/lib/serial
          
BUILD_EXTRA_DEPS += java-files
CLEAN_EXTRA = *.class simbuild build doc app.xml 

java-files: $(wildcard *.java) java-dir SerialDataMessage.java CommandMessage.java Constants.java Types.java src/sensobyg.h 
	javac java/dk/sensobyg/network/tinyos/*.java
	jar cf sensobyg-tinyosnetwork-generated.jar -C java .
	rm -rf java

java-dir:
	rm -rf java
	mkdir java
	mkdir java/dk
	mkdir java/dk/sensobyg
	mkdir java/dk/sensobyg/network
	mkdir java/dk/sensobyg/network/tinyos

SerialDataMessage.java:
	mig java -target=null $(CFLAGS) -java-classname=dk.sensobyg.network.tinyos.SerialDataMessage src/sensobyg.h sensobyg_serial_data_msg -o java/dk/sensobyg/network/tinyos/$@

CommandMessage.java:
	mig java -target=null $(CFLAGS) -java-classname=dk.sensobyg.network.tinyos.CommandMessage src/sensobyg.h sensobyg_command_msg -o java/dk/sensobyg/network/tinyos/$@

Constants.java:
	ncg -target=$(PLATFORM) $(CFLAGS) -java-classname=dk.sensobyg.network.tinyos.Constants java src/SensoBygAppC.nc sensobyg.h -o java/dk/sensobyg/network/tinyos/$@

Types.java:
	ncg -target=$(PLATFORM) $(CFLAGS) -java-classname=dk.sensobyg.network.tinyos.Types java src/SensoBygAppC.nc sensobyg_types.h -o java/dk/sensobyg/network/tinyos/$@

include $(MAKERULES)